<?php 

use yii\jui\AutoComplete;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
//use yii;

use backend\models\TmeMerchandisecinfo;
?>
<?php 

 $merchandissort = new TmeMerchandisecinfo();
$merchandissortresult = TmeMerchandisecinfo::find()->all();

foreach ($merchandissortresult as $v){
	$tempv[]=$v['MerchandiseCID'];
	//$tempv[]=$v['MerchandiseCName'];
} 

?>
<?php 
$form = ActiveForm::begin([	
	'options'=>['enctype'=>'multipart/form-data','class'=>'form-horizontal','id'=>'merchandisup'],
	'fieldConfig'=>['template' =>'{label}<div class="col-sm-9">{input}{hint}<span class="help-inline col-xs-12 col-sm-7">{error}</span></div>',
	'labelOptions'=>['class' =>'col-sm-3 control-label no-padding-right'],
	'inputOptions'=>['class' =>'col-xs-10 col-sm-5'],
	'errorOptions'=>['class' =>'help-block middle']
	 ]
    ])
/*@var $form yii\widgets\ActiveForm */
?>
<table>
<tr>
<td><?= $form->field($merchandismodel, 'MerchandiseID')->textInput(['value'=>$MerchandiseID]) ?></td>
<td><?= $form->field($merchandismodel, 'UnitID')->dropDownList($listdata) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'ProStatusID')->dropDownList($listdata1) ?></td>
<td><?= $form->field($merchandismodel, 'MerchandiseCID')->widget(yii\jui\AutoComplete::className(),[
	'options'=>['style'=>["float"=>'left',   ]],	
	'clientOptions'=>[
	 'source'=>$tempv,  
],		
]) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'MerchandiseName')->textInput(['value'=>$MerchandiseName,'id'=>'merchandis-name']) ?></td>
<td><?= $form->field($merchandismodel, 'MerchandiseAB')->textInput(['value'=>$MerchandiseAB,'id'=>'merchandis-ab']) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'Price')->textInput(['value'=>$Price]) ?></td>
<td><?= $form->field($merchandismodel, 'SaleStatus')->textInput(['value'=>$SaleStatus]) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'Spec')->textInput(['value'=>$Spec]) ?></td>
<td><?= $form->field($merchandismodel, 'Describes')->textInput(['value'=>$Describes]) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'PicPath')->fileInput() ?></td>
<td><?= $form->field($merchandismodel, 'ClickCount')->textInput(['value'=>$ClickCount]) ?></td>
</tr>
<tr>
<td><?= $form->field($merchandismodel, 'Remark')->textInput(['value'=>$Remark]) ?></td>
<td><?=Html::input('hidden','action','updateM') ?></td>
</tr>
</table>
		  
<?php 
ActiveForm::end()
?>
<script>
$("#merchandis-name").keyup(function(){		 
	 var name = $(this).val();

	 $.ajax({
		  type:"post",
		  url:"http://oss.com/index.php?r=merchandis/merchandisupdate",
		  data:{
			  "action":"abc",
			   name:name
		  },
		  //dataType:"html",
		  success:function(msg){
				$("#merchandis-ab").empty().val(msg);
		  }		
	  });	 	 	 
})

                          //商品类别选择触发事件
							$("#merchandisform-merchandisecid").blur(function(){
								
								var value = $(this).val();
								alert(value);
								$.ajax({
									type:"post",
								     url:"index.php?r=merchandis/merchautodata",								   
								     dataType:"html",
								     data:{
								    	 "action":"kkk", 
								    	  value:value
								     },
									success:function(msg){												
									  $("#merchandisform-merchandisecid").empty().val(msg);
									}										
								});							
							})


</script>


